package com.antsoft.database.mybatis;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

import com.antsoft.database.druid.DataSourceConfiguration;

/**
 * Created by Jason on 2017/3/6.
 */
public class ReadWriteSplitRoutingDataSource extends AbstractRoutingDataSource {
	private Logger log = LoggerFactory.getLogger(DataSourceConfiguration.class);

    @Override
    protected Object determineCurrentLookupKey() {
    	log.info("当前数据源："+DbContextHolder.getDbType());
        return DbContextHolder.getDbType();
    }
}
